<template>
  <div class="container">
    <div class="container-top">
      <div class="top-name">运费管理</div>
    </div>
    <div class="main">
      <el-form
        ref="information"
        label-width="180px"
        class=""
      >
        <el-form-item
          style="margin-bottom:30px"
          label="运费:"
          prop="fright"
        >
          <el-input
            v-model="fright"
            placeholder="请输入"
          ></el-input>
          <span style="margin-left:20px">红包</span>
        </el-form-item>
        <el-form-item >
          <el-button
            type="primary"
            @click="submitForm('information')"
            :loading="loading"
          >保存</el-button>
        </el-form-item>
      </el-form>
    </div>

  </div>

</template>

<script>
let CONSTANT = require("../../constant/constant.js");
let common = require("../../common.js");
import $ from "jquery";
export default {
  data() {
    return {
      isEdit: false,
      fright: "",
      sortArr: [],
      rules: {},
      loading:false
    };
  },
  components: {},
  mounted() {
    this.getDetailById();
  },
  methods: {
    getDetailById: function() {
      let url = CONSTANT.URL.LIST.PRODUCTFREIGHT;
      common.get(url, '', res => {
        if (res.code == 200) {
          let data = res.data.bussData;
          this.fright = data;
        }
      });
    },
    submitForm() {
      this.loading = true;
      let url = CONSTANT.URL.LIST.PRODUCTFREIGHTSAVE;
      common.get(url, this.fright, res => {
        if (res.code == 200) {
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          this.loading = false;
        } else {
          this.$message({
            type: "error",
            message: res.msg
          });
          this.loading = false;
        }
      });
    }
  }
};
</script>
<style lang="scss" scoped>
</style>